package com.ht.medicaltreatment.adapter

import android.graphics.Color
import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.OrderListBean

class OrderListAdapter : BaseQuickAdapter<OrderListBean,BaseViewHolder>(R.layout.item_order_list){
    override fun convert(holder: BaseViewHolder, item: OrderListBean) {
        holder.setText(R.id.tvCode,"${getItemPosition(item)+1}")
              .setText(R.id.tvOrderCode,"${item.orderNumber}")
              .setText(R.id.tvOrderName,"${item.orderName}")
        val state = holder.getView<TextView>(R.id.tvState)
        if(item.status == 0){
            state.text = "未完成"
            state.setTextColor(Color.RED)
        }else{
            state.text = "已完成"
            state.setTextColor(Color.BLACK)
        }
       /* val line = holder.getView<View>(R.id.line)
        if(getItemPosition(item) == data.size - 1){
            line.visibility = View.GONE
        }else{
            line.visibility = View.VISIBLE
        }*/
    }

}
